@PACKAGE_INIT@

set(export_config_name "@export_config_name@")

set_and_check(${export_config_name}Targets "${CMAKE_CURRENT_LIST_DIR}/${export_config_name}Targets.cmake")

include(${${export_config_name}Targets})
include(CMakeFindDependencyMacro)

# iMSTK settings
set(iMSTK_ROOT ${PACKAGE_PREFIX_DIR})
set(iMSTK_ENABLE_VR @iMSTK_ENABLE_VR@)
set(iMSTK_USE_Vulkan @iMSTK_USE_Vulkan@)
set(iMSTK_USE_OpenHaptics @iMSTK_USE_OpenHaptics@)
set(iMSTK_BUILD_TESTING @iMSTK_BUILD_TESTING@)

# Use the iMSTK modules to find all required packages
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
include(${CMAKE_CURRENT_LIST_DIR}/modules/imstkFind.cmake)
include(CMakeFindDependencyMacro)
set(CMAKE_DEBUG_POSTFIX @CMAKE_DEBUG_POSTFIX@)

# Assimp
find_package( Assimp REQUIRED )

# Eigen3
set(Eigen3_DIR @Eigen3_DIR@)
find_dependency( Eigen3 REQUIRED )

# FTD2XX
if(WIN32)
  find_package( FTD2XX REQUIRED )
endif()

# g3log
find_package( g3log REQUIRED )

# glm
set(glm_DIR @glm_DIR@)
find_dependency( glm REQUIRED )

# GTest
if(iMSTK_BUILD_TESTING)
  set(GTest_DIR @GTest_DIR@)
  find_dependency( GTest REQUIRED NO_DEFAULT_PATH )
endif()

# imgui
find_package( imgui REQUIRED )

# LibNiFalcon
find_package( LibNiFalcon REQUIRED)

# Libusb
find_package( Libusb REQUIRED)

# OpenVR
if(iMSTK_ENABLE_VR)
  add_definitions( -DiMSTK_ENABLE_VR )
  find_package( openvr REQUIRED )
endif()

# PhysX
find_package(PhysX REQUIRED)
#
#SCCD
find_package( SCCD REQUIRED )

# SFML
if(WIN32)
  find_package( SFML REQUIRED )
  add_definitions( -DiMSTK_AUDIO_ENABLED )
endif()

# tbb
find_package(tbb REQUIRED)
if (MSVC)
  add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE=1)
endif()

# VegaFEM
set(VegaFEM_DIR "@VegaFEM_DIR@")
find_dependency( VegaFEM REQUIRED CONFIG )

# VRPN
find_package( VRPN REQUIRED )
if(iMSTK_USE_OpenHaptics)
  find_package( OpenHapticsSDK REQUIRED )
  add_definitions( -DiMSTK_USE_OPENHAPTICS )
endif()

# VTK
set(VTK_DIR @VTK_DIR@)
find_dependency(VTK CONFIG)
# modules are linked via `VTK::CommonCore`
# vtk_module_autoinit is needed
list(APPEND VTK_DEPENDENCIES
  ChartsCore
  CommonCore
  CommonDataModel
  FiltersGeneral
  FiltersSources
  FiltersModeling
  FiltersExtraction
  IOExport
  IOImport
  IOPLY
  IOParallel
  IOParallelXML
  ImagingCore
  InteractionStyle
  RenderingAnnotation
  RenderingContext2D
  RenderingContextOpenGL2
  RenderingCore
  RenderingOpenGL2
  RenderingVolume
  RenderingVolumeOpenGL2
  ViewsContext2D)
if (${PROJECT_NAME}_ENABLE_VR)
  list(APPEND VTK_DEPENDENCIES vtkRenderingOpenVR)
endif()
find_dependency(VTK COMPONENTS ${VTK_DEPENDENCIES})

# glfw, gli
if(iMSTK_USE_Vulkan)
  find_package( glfw REQUIRED )
  find_package( gli REQUIRED )
  find_package( VulkanSDK REQUIRED)
  add_definitions( -DiMSTK_USE_Vulkan )
endif()
